var Bingo = (function () {
    var instantiated;

    function init() {
        return {
            getLocation: function () {
                if (navigator.geolocation) {
                    navigator.geolocation.getCurrentPosition(Bingo.getInstance().showPosition);
                } else {
                    console.log("Geolocation is not supported by this browser.");
                }
            },
            showPosition: function (position) {
                var api = "/util/weather";
                $.get(api, {longitude: position.coords.longitude, latitude: position.coords.latitude}, function (json) {
                    $("#weather\\.weather").val(json.weather);
                    $("#weather\\.location").val(json.location);
                    console.log(json);
                })
            }
        };
    };
    return {
        getInstance: function () {
            if (!instantiated) {
                instantiated = init();
            }
            return instantiated;
        }
    }

})();